// components/playing/player/index.js
let musicBehaviors = require('../../../behaviors/playmusic.js')
let {
  getHotInfo
} = require("../../../utils/request")
Component({
  behaviors: [musicBehaviors],
  /**
   * 组件的属性列表
   */
  properties: {
    musicObj: Object,
    isplay: Boolean,
    lyric: Array,
    lyricIndex: Number
  },

  /**
   * 组件的初始数据
   */
  data: {
    current: 0,
    into: "a0",
    // 默认播放索引
    index: 0

  },
  observers: {
    "lyricIndex": function (b) {
      // if (this.data.lyricIndex-this.data.index>=3) {
      //   this.setData({
      //     index: this.data.lyricIndex,
      //     into: "a" +(this.data.lyricIndex-3)
      //   })
      // }
      if(b!=this.data.index){
        this.setData({
          index:b,
          into:"a"+(b-3)
        })
      }
    }
  },
  lifetimes: {
    //  attached(){
    //    console.log(this.data.playindex);
    //    this.getMusicMsg()
    //  }
  },
  // observers:{
  //   "playindex":function(a){
  //     console.log(a);

  //     this.getMusicMsg();
  //   }
  // },


  /**
   * 组件的方法列表
   */
  methods: {
    getCurrent(e) {
      console.log(e.detail.current);
      // 获取当前轮播图的索引值
      let current = e.detail.current
      this.setData({
        current: current
      })
    },

  }
})